package com.coolbi.security.web.action;

import com.coolbi.common.web.action.BaseAction;
import com.coolbi.security.constant.LoginConstant;
import com.coolbi.security.entity.User;

public class SessionAction extends BaseAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 获得当前登陆的用户信息
	 * @return
	 */
	public User getCurrentUser(){
		Object userObject = getSession(LoginConstant.CURRENT_USER);
		return  userObject == null ? null : (User) userObject;
	}
	
	/**
	 * 注销当前登录用户信息
	 */
	public void removeCurrentUser() {
		removeSession(LoginConstant.CURRENT_USER);
	}
	
}
